using System.Data;
using System.Data.SqlClient;
using VanTaiProperty;

namespace VanTaiData
{
	public class clsTMNationalController
	{
	private clsConnect cls = new clsConnect();

	#region[Get-Data]
	public DataTable Search(string keywords)
	{
	return cls.Search("sp_TMNational_Search","@KEYWORDS",keywords);
	}
	public DataTable BindGirdTMNational_Detail_Edit(int id)
	{
        return cls.LayDuLieuParameter("sp_TMNational_Detail","@National_ID", id);
	}
	#endregion

	#region[Insert-Update-Delete]
	public bool InsertTMNational(clsTMNationalProperty data)
	{
	cls.CreateNewSqlCommand();
	cls.AddParameter("@National_Alias", data.National_Alias);
	cls.AddParameter("@National_Name", data.National_Name);
	cls.AddParameter("@National_Foreign", data.National_Foreign);
	cls.AddParameter("@National_Note", data.National_Note);
	cls.AddParameter("@National_MaCha", data.National_MaCha);
    cls.ExecuteNonQuery("sp_TMNational_Insert");
	return true;
	}
	#endregion

	#region Update
	public bool UpdateTMNational(clsTMNationalProperty data)
	{
	cls.CreateNewSqlCommand();
	cls.AddParameter("@National_ID", data.National_ID);
	cls.AddParameter("@National_Alias", data.National_Alias);
	cls.AddParameter("@National_Name", data.National_Name);
	cls.AddParameter("@National_Foreign", data.National_Foreign);
	cls.AddParameter("@National_Note", data.National_Note);
	cls.AddParameter("@National_MaCha", data.National_MaCha);
    cls.ExecuteNonQuery("sp_TMNational_Update");
	return true;
	}
	#endregion

	#region Delete
	public bool DeleteTMNational(int id)
	{
        cls.Delete("sp_TMNational_Delete", "@National_ID", id);
	return true;
	}
	#endregion
	}
}